更新 体检问卷,检前问卷

main
鹿和sa0ChunLuyu 1 year ago
parent 86156076f7
commit bebd047a71

@ -72,6 +72,13 @@ class ApiMapController extends Controller
'FenzhenInfo' => $base_url . '/api/H5/Fenzhen/info',// 分诊项目详情
'FenzhenCheck' => $base_url . '/api/H5/Fenzhen/check',// 分诊检测
'QuestionGet' => $base_url . '/api/H5/Question/get',// 问卷调查
'QuestionSubmit' => $base_url . '/api/H5/Question/submit',// 问卷提交
'QuestionLogInfo' => $base_url . '/api/H5/QuestionLog/info',// 提交信息
'QuestionLogList' => $base_url . '/api/H5/QuestionLog/list',// 问卷列表
'QuestionLogDelete' => $base_url . '/api/H5/QuestionLog/delete',// 问卷删除记录
'QuestionLogPush' => $base_url . '/api/H5/QuestionLog/push',// 上次答题记录
];
}

@ -0,0 +1,81 @@
<?php
namespace App\Http\Controllers\API\H5;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class QuestionnaireController extends Controller
{
public function get(Request $request)
{
$id = $request->post('id');
$person = $request->post('person');
$question = DB::table('questionnaires')->where('id', $id)->first();
if (!$question) {
return \Yz::echoError('问卷不存在');
}
$question_ids = json_decode($question->questions, true);
$person_info = DB::table('web_user_person')->where('id', $person)->first();
$list = self::getList($person_info, $question_ids);
return \Yz::Return(true, '操作完成', [
'info' => $question,
'list' => $list
]);
}
public function getList($person, $ids, $level = 0)
{
$list = [];
$replace_array = ['name', 'birthday', 'phone', 'id_number'];
foreach ($ids as $id) {
$question = DB::table('question_questions')->where('id', $id)->first();
if (!!$question) {
if ($level < 2) {
$question->option = json_decode($question->option, true);
$item_data = [
'id' => $question->id,
'type' => $question->type,
'question' => $question->question,
'value' => '',
];
if ($question->type == 'input') {
$item_data['value'] = $question->option['input']['value'];
$item_data['placeholder'] = $question->option['input']['placeholder'];
} else {
$item_data['value'] = '';
$select = $question->option['select']['value'];
$select_array = [];
foreach ($select as $select_value) {
$push_item = [
'content' => $select_value['content'],
'children' => []
];
if ($select_value['type'] == 'questions') {
$children = self::getList($person, $select_value['questions'], $level + 1);
if (count($children) > 0) {
$push_item['children'] = $children;
}
}
$select_array[] = $push_item;
}
$item_data['select'] = $select_array;
}
$v = $item_data['value'];
foreach ($replace_array as $replace_item) {
if (!!$person) {
$v = str_replace('${' . $replace_item . '}', $person->$replace_item, $v);
} else {
$v = str_replace('${' . $replace_item . '}', '', $v);
}
}
$v = str_replace('${体重}', '', $v);
$item_data['value'] = $v;
$list[] = $item_data;
}
}
}
return $list;
}
}

@ -0,0 +1,225 @@
<?php
namespace App\Http\Controllers\API\H5;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class QuestionnairesLogsController extends Controller
{
public function delete(Request $request)
{
$id = $request->post('id');
$person_id = $request->post('person');
$person_info = DB::table('web_user_person')->where('id', $person_id)->first();
if (!$person_info) {
return \Yz::echoError('人员信息不存在');
}
$log_info = DB::table('questionnaires_logs')->where('id', $id)->where('person_id', $person_id)->first();
if (!$log_info) {
return \Yz::echoError('问卷信息不存在');
}
DB::table('questionnaires_logs')->where('id', $id)->update(['del' => 1]);
return \Yz::Return(true, '操作完成');
}
public function list(Request $request)
{
$person_id = $request->post('person');
$person_info = DB::table('web_user_person')->where('id', $person_id)->first();
if (!$person_info) {
return \Yz::echoError('人员信息不存在');
}
$log = DB::table('questionnaires_logs')->select(['*'])
->selectRaw("IFNULL((select `name` from questionnaires where questionnaires.id = questionnaires_logs.person_id),'') as title")
->where('items', '[]')
->where('person_id', $person_id)
->where('del', 2)
->orderBy('id', 'desc')->get();
$list = [];
foreach ($log as $value) {
$person_info = json_decode($value->person_info, true);
$age = !!$person_info['birthday'] ? date('Y') - date('Y', strtotime($person_info['birthday'])) : 0;
$check_items = json_decode($value->check_items, true);
$count = count($check_items);
$list[] = [
'id' => $value->id,
'title' => $value->title,
'name' => $person_info['name'],
'age' => $age,
'created_at' => $value->created_at,
'count' => $count
];
}
return \Yz::Return(true, '操作完成', [
'list' => $list,
]);
}
public function push(Request $request)
{
$id = $request->post('id');
$person_id = $request->post('person');
$person_info = DB::table('web_user_person')->where('id', $person_id)->first();
if (!$person_info) {
return \Yz::echoError('人员信息不存在');
}
$log_info = DB::table('questionnaires_logs')->where('question_id', $id)->where('person_id', $person_id)->orderBy('id', 'desc')->first();
if (!$log_info) {
return \Yz::echoError('未查询到答题记录');
}
$content = json_decode($log_info->content, true);
return \Yz::Return(true, '操作完成', [
'info' => $content,
]);
}
public function info(Request $request)
{
$id = $request->post('id');
$person_id = $request->post('person');
$person_info = DB::table('web_user_person')->where('id', $person_id)->first();
if (!$person_info) {
return \Yz::echoError('人员信息不存在');
}
$log_info = DB::table('questionnaires_logs')->where('id', $id)->where('person_id', $person_id)->first();
if (!$log_info) {
return \Yz::echoError('问卷信息不存在');
}
$person_info = json_decode($log_info->person_info, true);
$age = !!$person_info['birthday'] ? date('Y') - date('Y', strtotime($person_info['birthday'])) : 0;
$weight = !!$log_info->weight ? $log_info->weight : 0;
$items_ids = json_decode($log_info->check_items, true);
$check_items = [];
if (!!count($items_ids)) {
$items_info = DB::table('question_items')->whereIn('id', $items_ids)->get();
foreach ($items_info as $key => $value) {
$check_items[] = [
'id' => $value->id,
'name' => $value->name,
];
}
}
$items = json_decode($log_info->items, true);
$check_items_array = json_decode($log_info->check_items_array, true);
return \Yz::Return(true, '操作完成', [
'date' => date('Y-m-d', strtotime($log_info->created_at)),
'age' => $age,
'weight' => $weight == '0' ? '-' : $weight,
'items' => $items,
'check_items' => $check_items,
'check_items_array' => $check_items_array,
'price' => [
'jichu' => self::sum_items($items, $check_items_array['jichu']),
'tuijian' => self::sum_items($items, $check_items_array['tuijian']),
'gaoduan' => self::sum_items($items, $check_items_array['gaoduan']),
]
]);
}
public function sum_items($items, $check_items)
{
$sum = DB::table('items')->whereIn('item_id', $items)->where('status', 1)->sum('price');
$check_sum = DB::table('items')->whereIn('item_id', $check_items)->where('status', 1)->sum('price');
return round($sum + $check_sum, 2);
}
public function submit(Request $request)
{
$question_id = $request->post('question_id');
$content = $request->post('content');
$question_info = DB::table('questionnaires')->where('id', $question_id)->first();
if (!$question_info) {
return \Yz::echoError('问卷不存在');
}
$person_id = $request->post('person_id');
$person_info = DB::table('web_user_person')->where('id', $person_id)->first();
if (!$person_info) {
return \Yz::echoError('人员信息不存在');
}
$type = $question_info->type;
$items = json_decode($question_info->items, true);
$check_items = [];
$check_items_array = [
'jichu' => [],
'tuijian' => [],
'gaoduan' => [],
];
$question_ids = [];
$question_map = [];
foreach ($content as $key => $value) {
$question_ids[] = $value['id'];
$question_map["q{$value['id']}"] = $value;
}
if (!!count($question_ids)) {
$question_questions = DB::table('question_questions')->whereIn('id', $question_ids)->get();
} else {
$question_questions = [];
}
$weight = 0;
foreach ($question_questions as $value) {
$id = $value->id;
$option = json_decode($value->option, true);
if ($value->type === 'input') {
if ($option['input']['value'] === '${体重}') {
if (isset($question_map["q{$id}"])) {
$weight = $question_map["q{$id}"]['value'];
}
}
} else {
if (isset($question_map["q{$id}"])) {
$v = $question_map["q{$id}"]['active'];
$item_option = $option['select']['value'][$v];
if ($item_option['type'] === 'items') {
foreach ($item_option['items'] as $item) {
if (!in_array($item, $check_items)) {
$check_items_info = DB::table('question_items')->where('id', $item)->first();
if (!!$check_items_info) {
$check_items[] = (string)$item;
$jichu_ids = json_decode($check_items_info->jichu, true);
foreach ($jichu_ids as $jichu_id) {
if (!in_array($jichu_id, $check_items_array['jichu']) && !in_array($jichu_id, $items)) {
$check_items_array['jichu'][] = $jichu_id;
}
}
$tuijian_ids = json_decode($check_items_info->tuijian, true);
foreach ($tuijian_ids as $tuijian_id) {
if (!in_array($tuijian_id, $check_items_array['tuijian']) && !in_array($tuijian_id, $items)) {
$check_items_array['tuijian'][] = $tuijian_id;
}
}
$gaoduan_ids = json_decode($check_items_info->gaoduan, true);
foreach ($gaoduan_ids as $gaoduan_id) {
if (!in_array($gaoduan_id, $check_items_array['gaoduan']) && !in_array($gaoduan_id, $items)) {
$check_items_array['gaoduan'][] = $gaoduan_id;
}
}
}
}
}
}
}
}
}
preg_match_all('/\d+/', $weight, $matches);
$weight = $matches[0][0];
$weight = $weight ? $weight : 0;
$log_id = DB::table('questionnaires_logs')->insertGetId([
'question_id' => $question_id,
'type' => $type,
'weight' => $weight,
'order_id' => '0',
'person_id' => $person_id,
'person_info' => json_encode($person_info, JSON_UNESCAPED_UNICODE),
'content' => json_encode($content, JSON_UNESCAPED_UNICODE),
'items' => json_encode($items, JSON_UNESCAPED_UNICODE),
'check_items' => json_encode($check_items, JSON_UNESCAPED_UNICODE),
'check_items_array' => json_encode($check_items_array, JSON_UNESCAPED_UNICODE),
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]);
return \Yz::Return(true, '操作完成', [
'id' => $log_id
]);
}
}

@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class QuestionnairesLogs extends Model
{
use HasFactory;
}

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateQuestionnairesLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('questionnaires_logs', function (Blueprint $table) {
$table->id();
$table->bigInteger('question_id')->comment('问卷ID');
$table->string('type', 20)->comment('问卷类型 检前评估 问卷调查');
$table->string('weight', 20)->comment('体重');
$table->bigInteger('order_id')->comment('订单ID');
$table->bigInteger('person_id')->comment('体检人ID');
$table->longText('person_info')->comment('体检人信息');
$table->longText('content')->comment('问卷回答内容');
$table->longText('items')->comment('基础项目');
$table->longText('check_items')->comment('检测项目');
$table->longText('check_items_array')->comment('实际检测项目');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('questionnaires_logs');
}
}

@ -4,6 +4,13 @@ use Illuminate\Support\Facades\Route;
Route::any('/api/test', 'App\Http\Controllers\TestController@ApiTest');
Route::any("/api/H5/QuestionLog/push", [\App\Http\Controllers\API\H5\QuestionnairesLogsController::class, 'push']);
Route::any("/api/H5/QuestionLog/delete", [\App\Http\Controllers\API\H5\QuestionnairesLogsController::class, 'delete']);
Route::any("/api/H5/QuestionLog/list", [\App\Http\Controllers\API\H5\QuestionnairesLogsController::class, 'list']);
Route::any("/api/H5/QuestionLog/info", [\App\Http\Controllers\API\H5\QuestionnairesLogsController::class, 'info']);
Route::any("/api/H5/Question/submit", [\App\Http\Controllers\API\H5\QuestionnairesLogsController::class, 'submit']);
Route::any("/api/H5/Question/get", [\App\Http\Controllers\API\H5\QuestionnaireController::class, 'get']);
Route::any("/api/H5/Fenzhen/check", [\App\Http\Controllers\API\H5\FenzhenController::class, 'check']);
Route::any("/api/H5/Fenzhen/abandon", [\App\Http\Controllers\API\H5\FenzhenController::class, 'abandon']);
Route::any("/api/H5/Fenzhen/info", [\App\Http\Controllers\API\H5\FenzhenController::class, 'info']);

@ -230,6 +230,31 @@
"style": {
"navigationBarTitleText": "婚前检查"
}
},
{
"path": "pages/main/question/question/question",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/main/question/done/done",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{
"path": "pages/main/question/list/list",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/main/question/info/info",
"style": {
"navigationBarTitleText": ""
}
}
],

@ -0,0 +1,323 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
onShow
} from '@dcloudio/uni-app'
import {
useStore
} from '@/store'
const $store = useStore()
const $props = defineProps({
id: {
type: String,
default: '0'
}
});
const getUserInfo = async () => {
const response = await $api('UserInfo')
$response(response, () => {
$store.setUser(response.data.info);
getQuestionLogInfo()
})
}
const mountedAction = () => {
getUserInfo()
}
const question_info = ref(false)
const getQuestionLogInfo = async () => {
const response = await $api('QuestionLogInfo', {
id: $props.id,
person: $store.user.person_id,
})
$response(response, () => {
question_info.value = response.data
})
}
const config_ref = ref(null)
const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e
mountedAction()
}
}
const toPath = (path) => {
uni.navigateTo({
url: `/pages/main/question${path}`
})
}
const QuestionLogDelete = async () => {
const response = await $api('QuestionLogDelete', {
id: $props.id,
person: $store.user.person_id,
})
$response(response, () => {
uni.redirectTo({
url: `/pages/main/question/list/list`
})
})
}
onShow(() => {
if (!!config_ref.value) {
mountedAction()
}
})
</script>
<template>
<view>
<view v-if="!!$store.config">
<view :ref="configRef"></view>
</view>
<view v-if="!!question_info">
<view class="no_items_wrapper" v-if="question_info.items.length === 0">
<view class="done_icon_wrapper">
<uni-icons color="#ffffff" type="checkmarkempty" size="80"></uni-icons>
</view>
<view class="done_tip_wrapper">问卷已提交感谢您的参与</view>
</view>
<view v-else>
<view class="banner_wrapper">
<image src="@/static/assets/question/log.png"></image>
</view>
<view class="user_wrapper">
<view class="avatar_wrapper">
<image src="@/static/assets/question/avatar.png"></image>
</view>
<view class="user_info_wrapper">
<view class="user_item_wrapper">
<view class="user_value_wrapper">{{ question_info.age }}</view>
<view class="user_text_wrapper">评估年龄</view>
</view>
<view class="user_line_wrapper"></view>
<view class="user_item_wrapper">
<view class="user_value_wrapper">{{ question_info.weight }}</view>
<view class="user_text_wrapper">体重指数BMI</view>
</view>
</view>
</view>
<view class="user_blank_wrapper"></view>
<view class="item_wrapper">
<view class="item_title_wrapper">健康风险</view>
<view class="item_list_wrapper">
<view v-if="question_info.check_items.length === 0">· </view>
<view class="item_item_wrapper" v-for="(i,k) in question_info.check_items" :key="k">
· {{ i.name }}
</view>
</view>
</view>
<view class="bottom_button_wrapper">
<view @click="toPath(`/info/info?id=${$props.id}`)" class="check_button_wrapper">查看体检方案</view>
<view class="button_line_wrapper">
<view @click="toPath('/list/list')" class="short_button_wrapper">查看答题记录</view>
<view @click="QuestionLogDelete()" class="short_button_wrapper">删除评估记录</view>
</view>
</view>
<view class="bottom_blank_wrapper"></view>
</view>
</view>
</view>
</template>
<style scoped>
.no_items_wrapper {
margin-top: 300rpx;
}
.done_icon_wrapper {
width: 200rpx;
height: 200rpx;
background: #06A2F9;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: center;
border-radius: 99999rpx;
}
.done_tip_wrapper {
width: 500rpx;
margin: 0 auto;
font-size: 30rpx;
text-align: center;
font-weight: bold;
margin-top: 50rpx;
}
.bottom_blank_wrapper {
height: calc(340rpx + 20rpx);
}
.short_button_wrapper {
width: 326rpx;
height: 88rpx;
background: #239EA3;
border-radius: 44rpx;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
line-height: 88rpx;
text-align: center;
margin: 0 8rpx;
}
.button_line_wrapper {
display: flex;
align-items: center;
justify-content: center;
margin-top: 32rpx;
}
.check_button_wrapper {
width: 668rpx;
height: 88rpx;
background: #239EA3;
border-radius: 44rpx;
margin: 41rpx auto 0;
font-weight: 500;
font-size: 28rpx;
color: #FFFFFF;
line-height: 88rpx;
text-align: center;
}
.bottom_button_wrapper {
width: 750rpx;
height: 340rpx;
background: #FFFFFF;
box-shadow: 0rpx 1rpx 0rpx 0rpx #DBDCDD;
position: fixed;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.item_item_wrapper {
font-weight: 400;
font-size: 30rpx;
color: #595959;
line-height: 80rpx;
}
.item_list_wrapper {
margin-left: 32rpx;
margin-top: 30rpx;
}
.item_title_wrapper {
width: 314rpx;
height: 72rpx;
background: #DDFCFE;
border-radius: 0rpx 0rpx 20rpx 20rpx;
font-weight: 500;
font-size: 32rpx;
color: #4EBDC6;
text-align: center;
line-height: 72rpx;
margin: 0 auto;
}
.item_wrapper {
width: 710rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04);
border-radius: 15rpx;
margin: 16rpx auto 0;
padding-bottom: 100rpx;
}
.user_blank_wrapper {
height: 234rpx;
width: 100%;
}
.user_item_wrapper {
text-align: center;
width: 45%;
}
.user_line_wrapper {
width: 2rpx;
height: 110rpx;
background: #4C4E61;
opacity: 0.22;
}
.user_value_wrapper {
font-weight: 500;
font-size: 72rpx;
color: #232323;
}
.user_text_wrapper {
font-size: 24rpx;
color: #6C728B;
}
.user_info_wrapper {
display: flex;
align-items: center;
justify-content: center;
margin-top: 90rpx;
}
.banner_wrapper {
width: 750rpx;
height: 423rpx;
margin: 0 auto;
}
.banner_wrapper image {
width: 750rpx;
height: 423rpx;
display: block;
object-fit: contain;
}
.user_wrapper {
width: 710rpx;
height: 280rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04);
border-radius: 15rpx;
position: absolute;
top: 378rpx;
left: 50%;
transform: translateX(-50%);
}
.avatar_wrapper {
position: absolute;
top: 0;
left: 50%;
transform: translate(-50%, -50%);
width: 150rpx;
height: 150rpx;
background: #239EA3;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.avatar_wrapper image {
width: 140rpx;
height: 140rpx;
display: block;
object-fit: contain;
}
</style>

@ -0,0 +1,265 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
onShow
} from '@dcloudio/uni-app'
import {
useStore
} from '@/store'
const $store = useStore()
const $props = defineProps({
id: {
type: String,
default: '0'
}
});
const getUserInfo = async () => {
const response = await $api('UserInfo')
$response(response, () => {
$store.setUser(response.data.info);
getQuestionLogInfo()
})
}
const mountedAction = () => {
getUserInfo()
}
const question_info = ref(false)
const getQuestionLogInfo = async () => {
const response = await $api('QuestionLogInfo', {
id: $props.id,
person: $store.user.person_id,
})
$response(response, () => {
question_info.value = response.data
})
}
const config_ref = ref(null)
const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e
mountedAction()
}
}
const toPath = (path) => {
uni.navigateTo({
url: `/pages/main/question${path}`
})
}
const QuestionLogDelete = async () => {
const response = await $api('QuestionLogDelete', {
id: $props.id,
person: $store.user.person_id,
})
$response(response, () => {
uni.redirectTo({
url: `/pages/main/question/list/list`
})
})
}
const itemShow = (type) => {
const mergedArray = [...new Set([
...question_info.value.items,
...question_info.value.check_items_array[type]
])]
let query = "?itemIds=" + mergedArray.join(',');
uni.navigateTo({
url: "/pages/main/tj/tjxq" + query,
});
}
onShow(() => {
if (!!config_ref.value) {
mountedAction()
}
})
</script>
<template>
<view>
<view v-if="!!$store.config">
<view :ref="configRef"></view>
</view>
<view v-if="!!question_info">
<view class="tip_wrapper">
根据风险评估结果为您制定了以下不同档次的体检方案档次越高检查越深入
</view>
<view class="items_list_wrapper">
<view class="items_item_wrapper">
<view class="items_title_wrapper">
<view class="items_title_text_wrapper">基础推荐方案</view>
<view class="items_title_count_wrapper">
<text>{{ question_info.items.length + question_info.check_items_array.jichu.length }}</text>
<view class="count_icon_wrapper">
<uni-icons type="right" size="20"></uni-icons>
</view>
</view>
</view>
<view class="items_line_wrapper"></view>
<view class="items_tip_wrapper">
本方案根据您的身体状况进行基础检查经济实用避免过度检查
</view>
<view class="price_wrapper">¥ {{ question_info.price.jichu }}</view>
<view class="item_button_wrapper">
<view @click="itemShow('jichu')" class="button_wrapper">查看详细方案</view>
</view>
</view>
<view v-if="question_info.check_items_array.tuijian.length > 0" class="items_item_wrapper">
<view class="items_title_wrapper">
<view class="items_title_text_wrapper">中等推荐方案</view>
<view class="items_title_count_wrapper">
<text>{{ question_info.items.length + question_info.check_items_array.tuijian.length }}</text>
<view class="count_icon_wrapper">
<uni-icons type="right" size="20"></uni-icons>
</view>
</view>
</view>
<view class="items_line_wrapper"></view>
<view class="items_tip_wrapper">
本方案根据您的身体状况进行基础检查经济实用避免过度检查
</view>
<view class="price_wrapper">¥ {{ question_info.price.tuijian }}</view>
<view class="item_button_wrapper">
<view @click="itemShow('tuijian')" class="button_wrapper">查看详细方案</view>
</view>
</view>
<view v-if="question_info.check_items_array.gaoduan.length > 0" class="items_item_wrapper">
<view class="items_title_wrapper">
<view class="items_title_text_wrapper">高端推荐方案</view>
<view class="items_title_count_wrapper">
<text>{{ question_info.items.length + question_info.check_items_array.gaoduan.length }}</text>
<view class="count_icon_wrapper">
<uni-icons type="right" size="16"></uni-icons>
</view>
</view>
</view>
<view class="items_line_wrapper"></view>
<view class="items_tip_wrapper">
本方案根据您的身体状况进行基础检查经济实用避免过度检查
</view>
<view class="price_wrapper">¥ {{ question_info.price.gaoduan }}</view>
<view class="item_button_wrapper">
<view @click="itemShow('gaoduan')" class="button_wrapper">查看详细方案</view>
</view>
</view>
</view>
</view>
</view>
</template>
<style scoped>
.button_wrapper {
width: 230rpx;
height: 80rpx;
background: #FFFFFF;
border-radius: 40rpx;
border: 1px solid #E5E5E5;
font-weight: 400;
font-size: 28rpx;
color: #239EA3;
line-height: 80rpx;
text-align: center;
margin-right: 41rpx;
}
.item_button_wrapper {
display: flex;
align-items: center;
justify-content: end;
margin-top: 2rpx;
}
.price_wrapper {
font-weight: 500;
font-size: 28rpx;
color: #E95515;
line-height: 1;
margin-top: 40rpx;
margin-left: 37rpx;
}
.items_tip_wrapper {
width: 624rpx;
font-weight: 400;
font-size: 28rpx;
color: #4A5060;
line-height: 48rpx;
margin: 31rpx auto 0;
}
.items_line_wrapper {
margin: 0 auto;
width: 653rpx;
height: 1rpx;
background: #E3E3E4;
}
.count_icon_wrapper {
margin-left: 10rpx;
}
.items_title_count_wrapper {
display: flex;
align-items: center;
font-weight: 400;
font-size: 30rpx;
color: #4A5060;
line-height: 48rpx;
}
.items_title_text_wrapper {
font-weight: 500;
font-size: 34rpx;
color: #0C0C0C;
line-height: 1;
}
.items_title_wrapper {
display: flex;
align-items: center;
justify-content: space-between;
height: 106rpx;
width: calc(100% - 60rpx);
margin: 0 auto;
}
.items_list_wrapper {
margin-top: 25rpx;
}
.items_item_wrapper {
width: 710rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04);
border-radius: 15rpx;
margin: 15rpx auto 0;
padding-bottom: 18rpx;
}
.tip_wrapper {
width: 659rpx;
font-family: OPPOSans;
font-weight: 400;
font-size: 30rpx;
color: #4A5060;
line-height: 48rpx;
margin: 43rpx auto 0;
text-align: center;
}
</style>

@ -0,0 +1,233 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
onShow
} from '@dcloudio/uni-app'
import {
useStore
} from '@/store'
const $store = useStore()
const getUserInfo = async () => {
const response = await $api('UserInfo')
$response(response, () => {
$store.setUser(response.data.info);
getQuestionLogList()
})
}
const mountedAction = () => {
getUserInfo()
}
const question_list = ref([])
const getQuestionLogList = async () => {
const response = await $api('QuestionLogList', {
person: $store.user.person_id
})
$response(response, () => {
question_list.value = response.data.list
})
}
const config_ref = ref(null)
const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e
mountedAction()
}
}
const QuestionLogDelete = async (id) => {
const response = await $api('QuestionLogDelete', {
id: id,
person: $store.user.person_id,
})
$response(response, () => {
getQuestionLogList()
})
}
const toDone = (id) => {
uni.navigateTo({
url: `/pages/main/question/done/done?id=${id}`
})
}
onShow(() => {
if (!!config_ref.value) {
mountedAction()
}
})
</script>
<template>
<view>
<view v-if="!!$store.config">
<view :ref="configRef"></view>
</view>
<view>
<view @click="toDone(i.id)" v-for="(i,k) in question_list" :key="k" class="log_item_wrapper">
<view class="log_count_wrapper">
<view @click.stop="QuestionLogDelete(i.id)" class="log_del_wrapper" v-if="i.count === 0">
<image src="@/static/assets/question/del.png"></image>
</view>
<view v-else class="log_count_show_wrapper">
<view class="log_count_value_wrapper">{{ i.count }}</view>
<view class="log_count_text_wrapper">健康风险</view>
</view>
</view>
<view class="log_info_wrapper">
<view class="log_cover_wrapper">
<image src="@/static/assets/question/log_cover.png"></image>
</view>
<view class="log_content_wrapper">
<view class="log_title_wrapper">{{ i.title }}</view>
<view class="log_text_wrapper">
<view class="log_text_item_wrapper">
<view class="log_text_title_wrapper">姓名</view>
<view class="log_text_text_wrapper">{{ i.name }}</view>
</view>
<view class="log_text_item_wrapper">
<view class="log_text_title_wrapper">年龄</view>
<view class="log_text_text_wrapper">{{ i.age }}</view>
</view>
<view class="log_text_item_wrapper">
<view class="log_text_title_wrapper">评估时间</view>
<view class="log_text_text_wrapper">{{ i.created_at }}</view>
</view>
</view>
</view>
</view>
<view class="log_line_wrapper"></view>
<view class="log_bottom_wrapper">
<view class="log_status_wrapper">已完成</view>
</view>
</view>
</view>
</view>
</template>
<style scoped>
.log_del_wrapper {
width: 30rpx;
height: 32rpx;
margin: 0 auto;
}
.log_del_wrapper image {
width: 30rpx;
height: 32rpx;
display: block;
object-fit: contain;
}
.log_count_text_wrapper {
font-size: 24rpx;
color: #727272;
line-height: 60rpx;
}
.log_count_wrapper {
text-align: center;
position: absolute;
width: 110rpx;
height: 100rpx;
font-weight: 500;
font-size: 48rpx;
color: #DD2E28;
line-height: 60rpx;
top: 38rpx;
right: 6rpx;
}
.log_status_wrapper {
width: 140rpx;
height: 52rpx;
background: #EDFCFD;
border-radius: 10rpx;
border: 1px solid #81CDD0;
font-weight: 400;
font-size: 26rpx;
color: #239EA3;
line-height: 52rpx;
text-align: center;
margin-top: 15rpx;
margin-right: 20rpx;
}
.log_bottom_wrapper {
display: flex;
align-items: center;
justify-content: end;
}
.log_text_wrapper {
margin-left: 29rpx;
}
.log_line_wrapper {
width: 653rpx;
height: 1rpx;
background: #E3E3E4;
margin: 27rpx auto 0;
}
.log_text_item_wrapper {
display: flex;
align-items: center;
}
.log_text_text_wrapper {
font-weight: 400;
font-size: 26rpx;
color: #000000;
line-height: 70rpx;
}
.log_text_title_wrapper {
width: 140rpx;
font-weight: 400;
font-size: 26rpx;
color: #4A5060;
line-height: 53rpx;
}
.log_cover_wrapper {
width: 160rpx;
height: 202rpx;
margin-left: 20rpx;
}
.log_cover_wrapper image {
width: 160rpx;
height: 202rpx;
display: block;
object-fit: contain;
}
.log_info_wrapper {
display: flex;
margin: 40rpx auto 0;
}
.log_item_wrapper {
width: 710rpx;
padding-bottom: 15rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04);
border-radius: 15rpx;
margin: 15rpx auto 0;
overflow: hidden;
position: relative;
}
</style>

@ -0,0 +1,568 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
onShow
} from '@dcloudio/uni-app'
import {
useStore
} from '@/store'
import QuestionComponent from '../src/question.vue'
import Question2Component from '../src2/question.vue'
const $store = useStore()
const $props = defineProps({
id: {
type: String,
default: '0'
}
});
const getUserInfo = async () => {
const response = await $api('UserInfo')
$response(response, () => {
$store.setUser(response.data.info);
getQuestionGet()
})
}
const question_info = ref(false)
const question_list = ref([])
const question_active = ref(0)
const getQuestionGet = async () => {
const response = await $api('QuestionGet', {
id: $props.id,
person: $store.user.person_id,
})
$response(response, () => {
question_info.value = response.data.info
question_list.value = response.data.list
question_active.value = 0
})
}
const getQuestionLogPush = async () => {
const response = await $api('QuestionLogPush', {
id: $props.id,
person: $store.user.person_id,
})
$response(response, () => {
let content_map = {}
for (let i in response.data.info) {
content_map['c' + response.data.info[i]['index']] = response.data.info[i]
}
let list = question_list.value
for (let i in list) {
if (`c${Number(i) + 1}` in content_map) {
if (content_map[`c${Number(i) + 1}`].id === list[i].id) {
if ('active' in content_map[`c${Number(i) + 1}`]) {
setValue(String(Number(i) + 1), content_map[`c${Number(i) + 1}`].active)
} else {
setValue(String(Number(i) + 1), content_map[`c${Number(i) + 1}`].value)
}
}
}
if (list[i].type === 'select' && list[i].select[Number(list[i].value)].children.length > 0) {
let children = list[i].select[Number(list[i].value)].children
for (let ii in children) {
let question_index = `${Number(i) + 1}-${Number(ii) + 1}`
if (`c${question_index}` in content_map) {
if (content_map[`c${question_index}`].id ===
list[i].select[Number(list[i].value)].children[ii].id) {
if ('active' in content_map[`c${question_index}`]) {
setValue(question_index, content_map[`c${question_index}`].active)
} else {
setValue(question_index, content_map[`c${question_index}`].value)
}
}
}
}
}
}
})
}
const mountedAction = () => {
getUserInfo()
}
const config_ref = ref(null)
const configRef = (e) => {
if (!config_ref.value) {
config_ref.value = e
mountedAction()
}
}
const setValue = (index, value) => {
const indexes = index.split('-').map(Number);
for (let i in indexes) {
indexes[i] = indexes[i] - 1
}
let type = question_list.value[indexes[0]].type
switch (indexes.length) {
case 1:
question_list.value[indexes[0]].value = value
break
case 2:
let content = Number(question_list.value[indexes[0]].value)
question_list.value[indexes[0]].select[content].children[indexes[1]].value = value
break
}
}
onShow(() => {
if (!!config_ref.value) {
mountedAction()
}
})
const submitClick = () => {
let value_array = []
let list = question_list.value
for (let i in list) {
if (!list[i].value && list[i].value === '') {
question_active.value = Number(i)
return uni.$lu.toast(`请填写第 ${Number(i) + 1}`)
}
let value_data = {
id: list[i].id,
index: String(Number(i) + 1),
question: list[i].question,
}
if (list[i].type === 'select') {
value_data['value'] = list[i].select[Number(list[i].value)].content
value_data['active'] = list[i].value
value_data['select'] = list[i].select.map((item) => {
return item.content
})
} else {
value_data['value'] = list[i].value
}
value_array.push(value_data)
if (list[i].type === 'select' && list[i].select[Number(list[i].value)].children.length > 0) {
let children = list[i].select[Number(list[i].value)].children
for (let ii in children) {
if (!children[ii].value && children[ii].value === '') {
question_active.value = Number(i)
return uni.$lu.toast(`请填写第 ${Number(i) + 1}-${Number(ii) + 1}`)
}
let child_value_data = {
id: children[ii].id,
index: `${Number(i) + 1}-${Number(ii) + 1}`,
question: children[ii].question,
value: children[ii].value
}
if (children[ii].type === 'select') {
child_value_data['value'] = children[ii].select[Number(children[ii].value)].content
child_value_data['active'] = children[ii].value
child_value_data['select'] = children[ii].select.map((item) => {
return item.content
})
} else {
child_value_data['value'] = children[ii].value
}
value_array.push(child_value_data)
}
}
}
QuestionSubmit(value_array)
}
const QuestionSubmit = async (content) => {
const response = await $api('QuestionSubmit', {
question_id: $props.id,
content: content,
person_id: $store.user.person_id,
})
$response(response, () => {
uni.redirectTo({
url: '/pages/main/question/done/done?id=' + response.data.id
})
})
}
const changePageUp = () => {
if (question_active.value === 0) {
return uni.$lu.toast('已经是第一题')
}
question_active.value--
}
const changePageDown = () => {
let list = question_list.value
if (question_active.value === list.length - 1) {
return uni.$lu.toast('已经是最后一题')
}
const i = question_active.value
if (!list[i].value && list[i].value === '') {
return uni.$lu.toast(`请填写第 ${Number(i) + 1}`)
}
if (list[i].type === 'select' && list[i].select[Number(list[i].value)].children.length > 0) {
let children = list[i].select[Number(list[i].value)].children
for (let ii in children) {
if (!children[ii].value && children[ii].value === '') {
return uni.$lu.toast(`请填写第 ${Number(i) + 1}-${Number(ii) + 1}`)
}
}
}
question_active.value++
}
const changeUserClick = () => {
uni.navigateTo({
url: '/pages/user/choose/choose'
})
}
</script>
<template>
<view>
<view v-if="!!$store.config">
<view :ref="configRef"></view>
</view>
<view v-if="question_list.length !== 0">
<view v-if="question_info.type === '检前评估'">
<view class="banner_wrapper">
<view @click="getQuestionLogPush()" class="push_log_wrapper">带入上次答题记录</view>
<image src="@/static/assets/question/banner.png"></image>
</view>
<view v-for="(i,k) in question_list" :key="k">
<QuestionComponent @setValue="setValue" :info="i" :index="String(k + 1)"></QuestionComponent>
</view>
<view @click="submitClick()" class="submit_button_wrapper">提交</view>
<view class="submit_blank_wrapper"></view>
</view>
<view v-else>
<view class="q2_banner_wrapper">
<view class="q2_banner_text_wrapper">健康问卷</view>
<image src="@/static/assets/question/q2banner.png"></image>
</view>
<view class="user_wrapper">
<view class="user_box_wrapper">
<view class="user_info_wrapper">
<view class="user_name_wrapper">{{ $store.user.name }}</view>
<view class="user_sex_wrapper">{{ Number($store.user.sex) === 1 ? '男士' : '女士' }}</view>
</view>
<view @click="changeUserClick()" class="change_user_button_wrapper">切换用户</view>
</view>
</view>
<view class="qr_title_wrapper">
<view class="qr_title_icon_wrapper">
<image src="@/static/assets/question/icon.png"></image>
</view>
<view class="qr_title_text_wrapper">
<view class="qr_title_title_wrapper">体检中心健康问卷</view>
<view class="qr_title_tip_wrapper">尊敬的先生/女士,为了能够更好地为您进行健康评估,请您认真填写以下问卷</view>
</view>
</view>
<view class="question_index_wrapper">
<text></text>
<text class="question_count_wrapper">{{ question_list.length }}</text>
<text> / </text>
<text class="question_count_wrapper">{{ question_active + 1}}</text>
<text></text>
</view>
<view v-for="(i,k) in question_list" :key="k">
<view class="q2_box_wrapper" v-if="question_active === k">
<view class="q2_card_wrapper">
<Question2Component @setValue="setValue" :info="i" :index="String(k + 1)">
</Question2Component>
</view>
<view class="page_button_wrapper">
<view class="page_button_line_wrapper"></view>
<view class="page_button_group_wrapper">
<view @click="changePageUp()" class="page_item_wrapper" :class="[
k === 0 ? 'disable' : ''
]">
<view class="page_icon_wrapper page_left_wrapper">
<image src="@/static/assets/question/next.png"></image>
</view>
<view class="page_text_wrapper">上一题</view>
</view>
<view @click="changePageDown()" class="page_item_wrapper" :class="[
k === question_list.length - 1 ? 'disable' : ''
]">
<view class="page_text_wrapper">下一题</view>
<view class="page_icon_wrapper">
<image src="@/static/assets/question/next.png"></image>
</view>
</view>
</view>
</view>
</view>
</view>
<view @click="submitClick()" class="q2_submit_button_wrapper">提交</view>
</view>
</view>
</view>
</template>
<style scoped>
.question_count_wrapper {
color: #36B6BA;
margin: 0 5rpx;
}
.question_index_wrapper {
display: flex;
align-items: center;
justify-content: end;
font-size: 16rpx;
color: #88888A;
margin-right: 40rpx;
margin-top: 40rpx;
}
.page_text_wrapper {
color: #595757;
font-size: 24rpx;
margin: 0 20rpx;
}
.page_icon_wrapper {
width: 12rpx;
height: 24rpx;
}
.page_icon_wrapper image {
width: 12rpx;
height: 24rpx;
display: block;
object-fit: contain;
}
.page_left_wrapper {
transform: rotate(180deg);
}
.page_item_wrapper {
display: flex;
align-items: center;
}
.page_item_wrapper.disable {
opacity: .6;
}
.page_button_group_wrapper {
display: flex;
align-items: center;
justify-content: space-between;
width: calc(100% - 120rpx);
margin: 0 auto;
height: 120rpx;
}
.page_button_wrapper {
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
.page_button_line_wrapper {
width: 599rpx;
height: 2rpx;
background: #B5B6B6;
margin: 0 auto;
}
.q2_submit_button_wrapper {
width: 514rpx;
height: 93rpx;
background: linear-gradient(90deg, #73BCBB 0%, #05A0A9 100%);
border-radius: 46rpx;
margin: 40rpx auto 0;
font-weight: 400;
font-size: 34rpx;
color: #FFFFFF;
line-height: 93rpx;
text-align: center;
}
.q2_card_wrapper {
width: 682rpx;
height: calc(100% - 125rpx);
overflow-y: auto;
}
.q2_box_wrapper {
width: 682rpx;
height: calc(100vh - 780rpx - 20rpx);
background: #ffffff;
border-radius: 10rpx;
margin: 10rpx auto 0;
position: relative;
}
.qr_title_tip_wrapper {
font-weight: 400;
font-size: 22rpx;
color: #898989;
line-height: 29rpx;
margin-top: 16rpx;
width: 469rpx;
}
.qr_title_text_wrapper {
margin-left: 28rpx;
}
.qr_title_title_wrapper {
font-size: 30rpx;
font-weight: bold;
color: #3F3B3B;
margin-top: 3rpx;
}
.qr_title_icon_wrapper {
width: 95rpx;
height: 100rpx;
margin-left: 78rpx;
}
.qr_title_icon_wrapper image {
width: 95rpx;
height: 100rpx;
display: block;
object-fit: contain;
}
.qr_title_wrapper {
display: flex;
align-items: center;
margin-top: 53rpx;
}
.change_user_button_wrapper {
width: 120rpx;
height: 39rpx;
background: url(@/static/assets/question/btn.png) repeat fixed center;
background-size: 120rpx 39rpx;
font-weight: 400;
font-size: 22rpx;
color: #FFFFFF;
line-height: 39rpx;
text-align: center;
border-radius: 999rpx;
margin-right: 39rpx;
}
.user_name_wrapper {
font-weight: 400;
font-size: 27rpx;
color: #5A5857;
line-height: 1;
margin-left: 43rpx;
}
.user_sex_wrapper {
font-weight: 400;
font-size: 22rpx;
color: #9F9FA0;
line-height: 1;
margin-left: 20rpx;
}
.user_info_wrapper {
display: flex;
align-items: end;
}
.user_box_wrapper {
width: 682rpx;
height: 100rpx;
background: #ffffff;
border-radius: 10rpx;
position: absolute;
left: 50%;
top: -39rpx;
transform: translateX(-50%);
display: flex;
align-items: center;
justify-content: space-between;
}
.user_wrapper {
position: relative;
height: calc(100rpx - 39rpx);
}
.q2_banner_text_wrapper {
color: #ffffff;
position: absolute;
top: 20rpx;
left: 20rpx;
font-size: 30rpx;
z-index: 9;
}
.q2_banner_wrapper {
position: relative;
width: 750rpx;
height: 226rpx;
overflow: hidden;
}
.q2_banner_wrapper image {
width: 750rpx;
height: 383rpx;
display: block;
object-fit: contain;
}
.submit_blank_wrapper {
height: 100rpx;
}
.submit_button_wrapper {
width: 520rpx;
height: 100rpx;
background: #239EA3;
border-radius: 50rpx;
margin: 40rpx auto 0;
font-weight: 500;
font-size: 34rpx;
color: #FFFFFF;
line-height: 100rpx;
text-align: center;
}
.banner_wrapper {
width: 724rpx;
height: 434rpx;
margin: 0 auto;
position: relative;
}
.push_log_wrapper {
position: absolute;
z-index: 9;
width: 210rpx;
height: 50rpx;
background: #38C6BC;
right: 30rpx;
top: -15rpx;
border-radius: 6rpx;
margin: 40rpx auto 0;
font-weight: 500;
font-size: 16rpx;
color: #FFFFFF;
line-height: 50rpx;
text-align: center;
}
.banner_wrapper image {
width: 724rpx;
height: 434rpx;
display: block;
object-fit: contain;
}
</style>

@ -0,0 +1,65 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref,
onMounted
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
onShow
} from '@dcloudio/uni-app'
import {
useStore
} from '@/store'
const $store = useStore()
const mountedAction = () => {
}
const QuestionLogDelete = async () => {
const response = await $api('QuestionLogDelete', {
id: $props.id,
person: $store.user.person_id,
})
$response(response, () => {
uni.redirectTo({
url: `/pages/main/question/list/list`
})
})
}
const delete_show = ref(false)
const deleteShow = () => {
delete_show.value = true
}
defineExpose({
deleteShow
})
onMounted(() => {
mountedAction()
})
</script>
<template>
<view class="delete_dialog_wrapper">
<view class="delete_box_wrapper"></view>
</view>
</template>
<style scoped>
.delete_dialog_wrapper {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: #00000020;
}
</style>

@ -0,0 +1,68 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref,
onMounted
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
useStore
} from '@/store'
const $emit = defineEmits(['setValue'])
const $store = useStore()
const $props = defineProps({
info: {
type: Object,
default: () => {
return {
id: 0
}
}
},
index: {
type: String,
default: ''
}
});
const mountedAction = () => {
}
const onKeyInput = (e) => {
$emit('setValue', $props.index, e.detail.value)
}
onMounted(() => {
mountedAction()
})
</script>
<template>
<view>
<view class="input_wrapper">
<input :value="$props.info['value']" @input="onKeyInput" />
</view>
</view>
</template>
<style scoped>
.input_wrapper {
width: 100%;
height: 60rpx;
border-radius: 6rpx;
border: 1rpx #cccccc solid;
margin-top: 20rpx;
}
.input_wrapper input {
height: 60rpx;
line-height: 60rpx;
padding-left: 20rpx;
}
</style>

@ -0,0 +1,97 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref,
onMounted
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
useStore
} from '@/store'
import InputComponent from './input.vue'
import SelectComponent from './select.vue'
const $emit = defineEmits(['setValue'])
const $store = useStore()
const $props = defineProps({
info: {
type: Object,
default: () => {
return {
id: 0
}
}
},
index: {
type: String,
default: ''
}
});
const mountedAction = () => {
}
const setValue = (index, value) => {
$emit('setValue', index, value)
}
onMounted(() => {
mountedAction()
})
</script>
<template>
<view>
<view :class="[
$props.index.includes('-') ? '' : 'question_block_wrapper'
]">
<view class="question_title_wrapper">
<text class="must_dot_wrapper">*</text>
<text v-if="$props.index.includes('-')" class="question_index_wrapper">({{ $props.index.split('-')[1] }}).</text>
<text v-else class="question_index_wrapper">{{ $props.index }}.</text>
<text class="question_question_wrapper">{{ $props.info['question'] }}</text>
</view>
<view v-if="$props.info.type === 'input'">
<InputComponent @setValue="setValue" :index="$props.index" :info="$props.info"></InputComponent>
</view>
<view v-else-if="$props.info.type === 'select'">
<SelectComponent @setValue="setValue" :index="$props.index" :info="$props.info"></SelectComponent>
</view>
</view>
</view>
</template>
<style scoped>
.question_question_wrapper {
margin-left: 10rpx;
}
.question_index_wrapper {
margin-left: 5rpx;
}
.must_dot_wrapper {
color: #DB2C0F;
}
.question_title_wrapper {
display: flex;
align-items: center;
font-weight: 500;
font-size: 28rpx;
}
.question_block_wrapper {
width: calc(710rpx - 40rpx);
background: #FFFFFF;
box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(0, 0, 0, 0.04);
border-radius: 15rpx;
padding: 36rpx 20rpx;
margin: 16rpx auto 0;
}
</style>

@ -0,0 +1,118 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref,
onMounted
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
useStore
} from '@/store'
import QuestionComponent from './question.vue'
const $emit = defineEmits(['setValue'])
const $store = useStore()
const $props = defineProps({
info: {
type: Object,
default: () => {
return {
id: 0
}
}
},
index: {
type: String,
default: ''
}
});
const mountedAction = () => {
}
const selectClick = (e) => {
if ($props.info.value === e) {
$emit('setValue', $props.index, '')
} else {
$emit('setValue', $props.index, e)
}
}
const setValue = (index, value) => {
$emit('setValue', index, value)
}
onMounted(() => {
mountedAction()
})
</script>
<template>
<view>
<view v-for="(i,k) in $props.info.select" :key="k" class="question_select_item_wrapper" @click="selectClick(k)">
<view class="select_checkbox_wrapper" :class="[
$props.info.value === k ? 'active' : ''
]"><uni-icons color="#ffffff" type="checkmarkempty" size="20"></uni-icons>
</view>
<text class="question_content_wrapper">{{ i.content }}</text>
</view>
<view v-if="$props.info.value !== '' && $props.info.select[$props.info.value].children.length !== 0">
<view class="bind_tip_wrapper">请回答以下关联问题</view>
<view v-for="(ii,ik) in $props.info.select[$props.info.value].children" :key="ik">
<view class="children_break_wrapper"></view>
<QuestionComponent @setValue="setValue" :info="ii" :index="`${$props.index}-${String(ik + 1)}`">
</QuestionComponent>
</view>
</view>
</view>
</template>
<style scoped>
.children_break_wrapper {
height: 20rpx;
}
.bind_tip_wrapper {
font-weight: 400;
font-size: 26rpx;
color: #828282;
line-height: 60rpx;
margin-top: 32rpx;
}
.question_content_wrapper {
width: calc(100% - 40rpx - 15rpx);
margin-left: 15rpx;
}
.question_select_item_wrapper {
display: flex;
align-items: center;
margin-top: 20rpx;
}
.select_checkbox_wrapper {
width: 36rpx;
height: 36rpx;
background: #FFFFFF;
color: #ffffff;
border-radius: 50%;
border: 2px solid #D9D9D9;
display: flex;
align-items: center;
justify-content: center;
}
.select_checkbox_wrapper.active {
width: 36rpx;
height: 36rpx;
background: #239EA3;
border-radius: 50%;
border: 2px solid #239EA3;
}
</style>

@ -0,0 +1,68 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref,
onMounted
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
useStore
} from '@/store'
const $emit = defineEmits(['setValue'])
const $store = useStore()
const $props = defineProps({
info: {
type: Object,
default: () => {
return {
id: 0
}
}
},
index: {
type: String,
default: ''
}
});
const mountedAction = () => {
}
const onKeyInput = (e) => {
$emit('setValue', $props.index, e.detail.value)
}
onMounted(() => {
mountedAction()
})
</script>
<template>
<view>
<view class="input_wrapper">
<input :value="$props.info['value']" @input="onKeyInput" />
</view>
</view>
</template>
<style scoped>
.input_wrapper {
width: 100%;
height: 60rpx;
border-radius: 6rpx;
border: 1rpx #cccccc solid;
margin-top: 20rpx;
}
.input_wrapper input {
height: 60rpx;
line-height: 60rpx;
padding-left: 20rpx;
}
</style>

@ -0,0 +1,93 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref,
onMounted
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
useStore
} from '@/store'
import InputComponent from './input.vue'
import SelectComponent from './select.vue'
const $emit = defineEmits(['setValue'])
const $store = useStore()
const $props = defineProps({
info: {
type: Object,
default: () => {
return {
id: 0
}
}
},
index: {
type: String,
default: ''
}
});
const mountedAction = () => {
}
const setValue = (index, value) => {
$emit('setValue', index, value)
}
onMounted(() => {
mountedAction()
})
</script>
<template>
<view>
<view :class="[
$props.index.includes('-') ? '' : 'question_block_wrapper'
]">
<view class="question_title_wrapper">
<text class="must_dot_wrapper">*</text>
<text class="question_index_wrapper">{{ $props.index }}.</text>
<text class="question_question_wrapper">{{ $props.info['question'] }}</text>
</view>
<view v-if="$props.info.type === 'input'">
<InputComponent @setValue="setValue" :index="$props.index" :info="$props.info"></InputComponent>
</view>
<view v-else-if="$props.info.type === 'select'">
<SelectComponent @setValue="setValue" :index="$props.index" :info="$props.info"></SelectComponent>
</view>
</view>
</view>
</template>
<style scoped>
.question_question_wrapper {
margin-left: 10rpx;
}
.question_index_wrapper {
margin-left: 5rpx;
}
.must_dot_wrapper {
color: #DB2C0F;
}
.question_title_wrapper {
display: flex;
align-items: center;
font-weight: 500;
font-size: 28rpx;
}
.question_block_wrapper {
width: calc(100% - 80rpx);
margin: 16rpx auto 0;
padding-top: 40rpx;
}
</style>

@ -0,0 +1,118 @@
<script setup>
/**
* name
* usersa0ChunLuyu
* date2024年9月11日 19:24:50
*/
import {
ref,
onMounted
} from 'vue'
import {
$api,
$response
} from '@/api'
import {
useStore
} from '@/store'
import QuestionComponent from './question.vue'
const $emit = defineEmits(['setValue'])
const $store = useStore()
const $props = defineProps({
info: {
type: Object,
default: () => {
return {
id: 0
}
}
},
index: {
type: String,
default: ''
}
});
const mountedAction = () => {
}
const selectClick = (e) => {
if ($props.info.value === e) {
$emit('setValue', $props.index, '')
} else {
$emit('setValue', $props.index, e)
}
}
const setValue = (index, value) => {
$emit('setValue', index, value)
}
onMounted(() => {
mountedAction()
})
</script>
<template>
<view>
<view v-for="(i,k) in $props.info.select" :key="k" class="question_select_item_wrapper" @click="selectClick(k)">
<view class="select_checkbox_wrapper" :class="[
$props.info.value === k ? 'active' : ''
]"><uni-icons color="#ffffff" type="checkmarkempty" size="20"></uni-icons>
</view>
<text class="question_content_wrapper">{{ i.content }}</text>
</view>
<view v-if="$props.info.value !== '' && $props.info.select[$props.info.value].children.length !== 0">
<view class="bind_tip_wrapper">请回答以下关联问题</view>
<view v-for="(ii,ik) in $props.info.select[$props.info.value].children" :key="ik">
<view class="children_break_wrapper"></view>
<QuestionComponent @setValue="setValue" :info="ii" :index="`${$props.index}-${String(ik + 1)}`">
</QuestionComponent>
</view>
</view>
</view>
</template>
<style scoped>
.children_break_wrapper {
height: 20rpx;
}
.bind_tip_wrapper {
font-weight: 400;
font-size: 26rpx;
color: #828282;
line-height: 60rpx;
margin-top: 32rpx;
}
.question_content_wrapper {
width: calc(100% - 40rpx - 15rpx);
margin-left: 15rpx;
}
.question_select_item_wrapper {
display: flex;
align-items: center;
margin-top: 20rpx;
}
.select_checkbox_wrapper {
width: 36rpx;
height: 36rpx;
background: #FFFFFF;
color: #ffffff;
border-radius: 50%;
border: 2px solid #D9D9D9;
display: flex;
align-items: center;
justify-content: center;
}
.select_checkbox_wrapper.active {
width: 36rpx;
height: 36rpx;
background: #239EA3;
border-radius: 50%;
border: 2px solid #239EA3;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Loading…
Cancel
Save