Commit 8b099a3a authored by 李文起's avatar 李文起
Browse files

Merge branch 'feature/v1.2.8' into 'master'

Feature/v1.2.8

See merge request !81
parents 96f27c1b 32b7c236
Showing with 92 additions and 0 deletions
+92 -0
<?php
namespace Yjtec\PanoEdit\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class HotspotArticle extends Model
{
use SoftDeletes;
protected $table = 'hotspot_articles';
protected $fillable = ['id','user_id','title','context'];
}
\ No newline at end of file
......@@ -37,6 +37,7 @@ class PanoEditServiceProvider extends ServiceProvider
$this->app->bind('Yjtec\PanoEdit\Repositories\Contracts\HotspotInterface', 'Yjtec\PanoEdit\Repositories\Eloquent\HotspotRepository');
$this->app->bind('Yjtec\PanoEdit\Repositories\Contracts\RingsInterface', 'Yjtec\PanoEdit\Repositories\Eloquent\RingsRepository');
$this->app->bind('Yjtec\PanoEdit\Repositories\Contracts\EventDataInterface', 'Yjtec\PanoEdit\Repositories\Eloquent\EventDataRepository');
$this->app->bind('Yjtec\PanoEdit\Repositories\Contracts\HotspotArticleInterface', 'Yjtec\PanoEdit\Repositories\Eloquent\HotspotArticleRepository');
}
}
<?php
namespace Yjtec\PanoEdit\Repositories\Contracts;
interface HotspotArticleInterface
{
}
\ No newline at end of file
<?php
namespace Yjtec\PanoEdit\Repositories\Eloquent;
use Yjtec\PanoEdit\Model\HotspotArticle;
use Yjtec\PanoEdit\Repositories\Contracts\HotspotArticleInterface;
use Yjtec\Repo\Repository;
class HotspotArticleRepository extends Repository implements HotspotArticleInterface
{
public function model()
{
return HotspotArticle::class;
}
}
\ No newline at end of file
<?php
namespace Yjtec\PanoEdit\Services\Hotspot\HotspotAction;
use Yjtec\PanoEdit\Repositories\Eloquent\HotspotArticleRepository;
class ArticleHotspot extends HotspotAction
{
/************************************************* 生成XML ****************************************************/
public function setNodeAttribute($xmlService,$sceneNode,$hotspotNode){
if ($this->data['action_data'] && !empty($this->data['action_data']['article_id'])) {
$this->data['onclick'] = 'show_rich_txt("data:article_hotspot_'.$this->data['id'].'");';
$this->setArticleData($sceneNode,$this->data['id']);
}
return $hotspotNode;
}
/**
* 设置富文本数据
* @param $sceneNode
* @param $hotspotId
*/
public function setArticleData($sceneNode,$hotspotId){
//获取当前热点文本
$hotsportArticle = resolve('Yjtec\PanoEdit\Repositories\Contracts\HotspotArticleInterface');
$articleData = $hotsportArticle->findBy($this->data['action_data']['article_id']);
$dataNode = self::$xmlService->createElement('data');
self::$xmlService->setAttribute($dataNode,['name'=>'article_hotspot_'.$hotspotId]);
$dataNode->nodeValue = htmlspecialchars_decode($articleData['content']);
self::$xmlService->appendChild($sceneNode,$dataNode);
}
/************************************************* 生成XML结束 ****************************************************/
}
\ No newline at end of file
......@@ -4,6 +4,7 @@
namespace Yjtec\PanoEdit\Service\Hotspot;
use Yjtec\PanoEdit\Services\Hotspot\HotspotAction\ArticleHotspot;
use Yjtec\PanoEdit\Services\Hotspot\HotspotAction\IframeHotspot;
use Yjtec\PanoEdit\Services\Hotspot\HotspotAction\RingsHotspot;
use Yjtec\PanoEdit\Services\Hotspot\HotspotAction\MusicHotspot;
......@@ -235,6 +236,13 @@ class HotspotOrdinary extends HotspotParent
break;
}
//富文本热点
case 10 : {
$hotspotNode = (new ArticleHotspot($this->data,self::$key,$this->sceneId,$this->sceneArray))->makeXml($sceneNode);
break;
}
//根据项目设置不同的热点
default : {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment